﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="RightsEdit.aspx.cs" Inherits="OneMG.Phoenix.AdminSite.Views.Passport.RightsEdit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    编辑权限
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadScripts" runat="server">
    <script charset="utf-8" src="/scripts/kindeditor/kindeditor-min.js" type="text/javascript"></script>
    <script charset="utf-8" src="/scripts/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
    
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="pd10">
        <form id="form1" method="post">
        <input type="hidden" id="hdAction" name="hdAction" value="<%=(objRights!=null)?"3":"1" %>" />
        <input type="hidden" id="hdRightID" name="hdRightID" value="<%=(objRights!=null)?objRights.RightID : 0 %>" />

        <table class="tb-list mt10">
            <tr>
                <td class="aR">
                    分类：
                </td>
                <td class="aL">
                    <select id="sltCategory" name="sltCategory">
                      <%foreach (OneMG.Phoenix.Service.Model.RightsTypeModel c in RightsTypeList)%>
                        <%{%>
                        <% if (objRights != null && c.TypeID == objRights.RightTypeID) %>
                        <%{%>
                        <option value="<%=c.TypeID %>" selected="selected"><%=c.TypeName%></option>
                        <%}%>
                        <%else %>
                        <%{ %>
                        <option value="<%=c.TypeID %>"><%=c.TypeName%></option>
                        <%} %>
                        <%}%>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="aR">
                    显示名称：
                </td>
                <td class="aL">
                    <input type="text" name="txtRightDisplayName" id="txtRightDisplayName" value="<%=(objRights!=null)?objRights.RightName:"" %>" maxlength="200" style="width: 350px" class="inputStyle" />
                </td>
            </tr>
            <tr>
                <td class="aR">
                    权限代码：
                </td>
                <td class="aL">
                    <input type="text" name="txtRightName" id="txtRightName" value="<%=(objRights!=null)?objRights.RightDisplayName:"" %>" maxlength="200" style="width: 350px" class="inputStyle" />
                </td>
            </tr>
            <tr>
                <td class="aR">
                    备注：
                </td>
                <td class="aL">
                    <textarea id="txtRightMemo"  name="txtRightMemo" cols="20" rows="5" ><%=(objRights!=null)?objRights.RightDisplayName:"" %></textarea>
                </td>
            </tr>
        </table>
        <div class="aC">
            <input name="save" value="保存" type="button" class="a-btn1" />
            <input name="clear" value="清空" id="clear" type="button" class="a-btn1" /></div>
        </form>
    </div>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Scripts" runat="server">
<script type="text/javascript">

        $('input[name=save]').click(function(e) {

            if ($("#txtRightDisplayName").val() == "") {
                alert('请输入显示名称!');
                return false;
            }

            if ($("#txtRightName").val() == "") {
                alert('请输入权限代码!');
                return false;
            }

            $.ajax({
            url: "/Views/Passport/RightsSave.ashx",
            data: { "Action": $("#hdAction").val(), "RightID": $("#hdRightID").val(), "RightMemo": $("#txtRightMemo").val(), "RightTypeID": $("#sltCategory").val(), "RightDisplayName": encodeURI($("#txtRightDisplayName").val()), "RightName": encodeURI($("#txtRightName").val()) },
                type: "post",
                success: function(data) {
                    if (data.status == "error" || data.status == "warning") {
                        alert(data.msg);
                        return;
                    }
                    alert(data.msg);
                }
            })
        });

    </script>
</asp:Content>

